
package ;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.input.mouse.FlxMouse;
import flixel.tweens.FlxTween;
import flixel.util.FlxPoint;

class Item extends FlxSprite
{

	public var name:String;
	private var type:Int;
	//private var tier:Int; might implement later, don't need now
	//public var count:Int;
	//public var img:String;
	private var _spawnPoint:InvHolder;
    public var worth:Int;

	/*public function new(X:Float=0, Y:Float=0, n:String, imgPath:String)
	{
		super(X, Y, "assets/images/" + imgPath);
		name = n;
		//assign name based on type;
		//assign tier based on type
		count = 0;
	}*/

	public function new(X:Float=0, Y:Float=0, n:String, imgPath:String, source:InvHolder)
	{
		super(X, Y, "assets/images/" + imgPath);
		setGraphicSize(80, 80);
		updateHitbox();
		scrollFactor.set();
		//img = imgPath;
		name = n;
		//assign name based on type;
		//assign tier based on type
		//count = c;
		_spawnPoint = source;
        worth = 1;
	}
	
	override public function update()
	{
		super.update();
		// used to be stuff here, might need it again
	}

	public function getName():String
	{
		//print name to inventory
		return name;
	}
	
	public function returnToSource() {
		FlxTween.tween(this, { x: _spawnPoint.x, y: _spawnPoint.y }, 0.25, { complete: finishReturn } );
	}
	
	private function finishReturn(_) {
		_spawnPoint.incrementCount();
		kill();
	}

	/*public function gotItem():Void
	{
		count++;
	}*/
}